#!/usr/bin python3
# -*- coding: utf-8 -*-

if __name__ == '__main__':
    n, k = [int(i) for i in input().split(' ')]
    a = [int(i) for i in input().split(' ')]
    b = [int(i) for i in input().split(' ')]

    res = []
    for i in a:
        for j in b:
            res.append(i*j)

    res.sort()
    print(res[k-1])
